package com.jia.lidao.ui.message;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jia.lidao.R;
import com.jia.lidao.enity.Message;

/**
 * Created by 00029935 on 2017/12/14.
 */

public class MessageNoticeAdapter extends QuickAdapter<Message.CategoryBean> {
    private Context context;

    public MessageNoticeAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getLayoutID(int viewType) {
        return R.layout.message_notice_adapter_item;
    }

    @Override
    public void convert(VH holder, Message.CategoryBean itemData, int position) {
        ImageView imageView = holder.getView(R.id.iv_pic);
        Glide.with(context).load(itemData.getIcon()).error(R.mipmap.news_agricultural).transform(new GlideCircleTransform(context))
                .into(imageView);

        TextView tvtitle = holder.getView(R.id.tv_title);
        tvtitle.setText(itemData.getName());

        TextView tvmessage = holder.getView(R.id.tv_message);
        tvmessage.setText(itemData.getContent());
        TextView tvcount = holder.getView(R.id.tv_count);
        tvcount.setText(String.valueOf(itemData.getCount()));
        if (itemData.getCount() == 0) {
            tvcount.setVisibility(View.INVISIBLE);
        }

    }
}
